feat(my-account): group subscription management UX#4763
Conversation
|
👋 Thanks for your interest in contributing to Newspack! Newspack development has moved to a single monorepo: Automattic/newspack-workspace. This repository is now a read-only mirror, so we're automatically closing new pull requests here. Please reopen your change against the monorepo – |
There was a problem hiding this comment.
Pull request overview
Adds end-to-end group subscription self-service to My Account: a new /group/ endpoint with single-group auto-redirect and a multi-group picker, member self-leave flow, publisher-configurable group label (singular/plural) wired through Audience → Setup, per-member join timestamps, and a member-friendly subscription view that hides financial details. Ships supporting Newspack UI library work (new tabs primitive shared with segmented-control, __row → __grid layout rename, dropdown rewrite using event delegation, modal/button loading-state improvements) and a member-aware menu that hides Orders/Payment information for group-only members.
Changes:
- Owner-facing group management UI (
group.php, picker, tabbed members/invitations panel, remove-member confirm modal, manageability gating for cancelled/expired subs) andLEAVE_GROUP_NONCE_ACTIONself-removal flow. - Publisher label override (
Group_Subscription::get_label, REST endpoints, Audience wizardGroupstab) propagated through every reader-facing string and the sidebar entry. - Newspack UI tabs component extracted from segmented-control, dropdown rewrite via document-level delegation, modal nested-form submit handling,
newspack-ui__row→newspack-ui__gridrename with new gap modifiers.
Reviewed changes
Copilot reviewed 45 out of 45 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| includes/plugins/woocommerce-subscriptions/group-subscription/class-group-subscription.php | Adds join-timestamp meta, get_label(), and get_managed_subscriptions_for_user(). |
| includes/plugins/woocommerce-subscriptions/group-subscription/class-group-subscription-myaccount.php | New group endpoint, picker/landing resolver, manageability + leave-group handlers, legacy 308 redirect. |
| includes/plugins/woocommerce-subscriptions/group-subscription/class-group-subscription-settings.php | Name fallback now product-name → singular label; registers label options. |
| includes/plugins/woocommerce/my-account/class-my-account-ui-v1.php | Group sidebar entry, dead-end Orders/Payment redirects, template map for new templates. |
| includes/plugins/woocommerce/my-account/class-woocommerce-my-account.php | Reorders top-of-menu items to include newsletters. |
| includes/plugins/woocommerce/my-account/templates/v1/group.php | New group page shell with header + invite-members dropdown. |
| includes/plugins/woocommerce/my-account/templates/v1/group-picker.php | New multi-group picker card layout. |
| includes/plugins/woocommerce/my-account/templates/v1/group-subscription-members.php | Empty state, tabs markup, manageable gating, remove-member modal, label-aware copy. |
| includes/plugins/woocommerce/my-account/templates/v1/subscription-header.php | Member leave-group button + modal; status badge always rendered. |
| includes/plugins/woocommerce/my-account/templates/v1/subscription-details.php | Hides financials for members, adds "Member since" and group-name rows. |
| includes/plugins/woocommerce/my-account/templates/v1/view-subscription.php | Skips totals/related-orders for members. |
| includes/plugins/woocommerce/my-account/templates/v1/payment-information.php | Switches layout primitives to __grid, refactors empty/populated address rendering. |
| includes/plugins/woocommerce/my-account/templates/v1/my-subscriptions.php | Uses Group_Subscription::get_label() for group badge. |
| includes/wizards/audience/class-audience-wizard.php | New REST endpoints for group label settings. |
| includes/util.php | New newspack_get_user_display_label() cascade helper. |
| includes/class-newspack-ui.php | Wraps modal action labels in <span>; demo content for new tabs. |
| includes/class-newspack-ui-icons.php | Adds lineSolid icon. |
| src/wizards/audience/views/setup/index.js | Registers Advanced settings tab/route. |
| src/wizards/audience/views/setup/groups.js | New screen wrapping GroupLabels. |
| src/wizards/audience/components/group-labels/index.js | New singular/plural label form. |
| src/newspack-ui/js/utils/index.js | Adds shared setupTabController. |
| src/newspack-ui/js/tabs/index.js | New tabs init. |
| src/newspack-ui/js/segmented-control/index.js | Reuses shared controller. |
| src/newspack-ui/js/modals.js | Adds loading state on submit; covers nested forms. |
| src/newspack-ui/js/dropdowns.js | Rewritten with document-level delegation. |
| src/newspack-ui/js/index.js | Imports tabs module. |
| src/newspack-ui/scss/elements/_layout.scss | Renames __row to __grid with new gap modifiers. |
| src/newspack-ui/scss/elements/_tabs.scss / _index.scss | New tabs SCSS. |
| src/newspack-ui/scss/elements/_boxes.scss | --2x-large size, :has(> __actions) semantic. |
| src/newspack-ui/scss/elements/misc/_dropdown.scss | --align-start/center/end modifiers. |
| src/newspack-ui/scss/elements/forms/_buttons.scss | Icon margin tweak for --line-solid. |
| src/newspack-ui/scss/elements/woocommerce/_my-account.scss | Table border/spacing/min-height; updates renamed class. |
| src/my-account/v1/index.js, global.js, subscriptions.js, group-subscriptions.js | Leave-group modal trigger; WC Blocks notice → snackbar; remove-member delegation; drops badge sync. |
| src/my-account/v1/style.scss, _group.scss, _group-subscriptions.scss, _subscriptions.scss | Empty-state/picker styling, compact subscription header buttons. |
| tests/unit-tests/content-gate/group-management-nav.php | New tests covering label helper, managed subs, endpoint, picker, menu. |
| tests/unit-tests/plugins/woocommerce-subscriptions/group-subscription/class-group-subscription-myaccount.php | Manageability + leave-group test coverage; manager-actions pass-through. |
| tests/unit-tests/plugins/woocommerce-subscriptions/group-subscription/class-group-subscription-settings.php | Name-fallback tests updated to product-name → singular label. |
| tests/unit-tests/content-gate/group-subscriptions.php | Updates fallback expectations to singular label. |
| tests/mocks/wc-mocks.php | Adds customer/subscription getters, status name, template map, filter application. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
All Submissions:
Changes proposed in this Pull Request:
Adds end-to-end group subscription self-service in My Account. Owners can manage members and invites from a dedicated group page; members can leave a group; multi-group owners get a picker. Publishers can override the "group" terminology (singular + plural) per site.
Owner-facing
/my-account/group/endpoint. Single-group owners drop straight into management; multi-group owners see a card picker showing member count and subscription status.Member-facing
Newspack UI library
aria-selected/tabindexkeyboard handling.__gridprimitive — real CSS grid (was responsive flex on the old__row). Default 1 col mobile / 2 cols desktop. Modifiers:--cols-{3,4,5,6}for fixed column counts,--gap-{0..12}for the gap scale, and--subgridfor shared column tracks across child rows.--2x-largesize modifier,:has(> __box__actions)semantic action layout, outline-button hover for anchor variants.--align-start/center/endmodifiers.<form>inside<section class="newspack-ui__modal__content">, not only the top-level case. Submit button labels wrapped in<span>so the loading spinner CSS works universally. Fetch-backed actions add the loading class to the button, not the span (prevents duplicate submits)..wc-block-components-notice-banner.is-success) in addition to legacy.woocommerce-message.Delete account modal
mediumwhen the user has subscriptions / donations / newsletters to suggest,smallotherwise.__row+__width--40layout into a__stack --horizontalper row, wrapped in a__grid --subgridcontainer so the action buttons align to the same column width regardless of label length.Publisher controls (Audience → Setup)
Group_Subscription::get_label().Utilities
newspack_get_user_display_label()inincludes/util.php: strategy-driven cascade for resolving a user's display name.Group_Subscription_MyAccount::is_subscription_manageable()helper, used to derive the read-only state for cancelled/expired group subscriptions.How to test the changes in this Pull Request:
Test using the QA seed at
html/qa-seed-group-subs.php(runwp eval-file /var/www/html/qa-seed-group-subs.php). Password for every seeded user ispassword.Owner — multi-group picker
marcus.aldridge@example.comand visit/my-account/. Confirm a sidebar entry exists for the group endpoint./my-account/group/{sub_id}/.Owner — empty state
Owner — populated state
Owner — invite flow spinner
Member — leave group
layla.shah@example.com(member of Imran's group)./my-account/view-subscription/{imran_sub_id}/. Confirm the subscription header shows Imran's display name only (no email).Member — hidden tabs
/my-account/. Navigation should NOT include Orders or Payment information (she's a group member with no orders of her own).Cancelled subscription owner
hassan.khoury@example.com(cancelled group). Visit his group page.Publisher label overrides
/group/(this is intentional — see the discussion thread).Member since timestamps
Delete account modal
eleanor.whitfield@example.com(she owns 1 active subscription).Other information: